﻿using System;
using System.ComponentModel;
using OpenLS.Drawing;
using OpenLS.Drawing.UI;
using OpenLS.Drawing.UI.Internals;

namespace OpenLS.Chart.UI.Internals
{
    internal class ShapedViewModel: INotifyPropertyChanged
    {
        private readonly IShape _model;

        public ShapedViewModel(IShape model)
        {
            _model = model;
        }
        public ShapeProperties ShapeProperties
        {
            get
            {
                if (_model.ShapeProperties == null)
                    _model.ShapeProperties = new ShapeProperties();
                return _model.ShapeProperties;
            }
        }
        public ShapeFillFormatter FillFormatter
        {
            get
            {
                return new ShapeFillFormatter(_model);
            }
        }
        public ShapeLineFillFormatter LineFillFormatter
        {
            get
            {
                return new ShapeLineFillFormatter((_model));
            }
        }
        public LineStyleFormatter LineStyleFormatter
        {
            get
            {
                return new LineStyleFormatter(_model);
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public void NotifyPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}